import * as THREE from "three";


export const Route=(option)=>{
  let curvePoints = new Array();
  for (let i=0;i<option.points.length;i++){
    let point = option.points[i];
    curvePoints.push(new THREE.Vector3(point.x,point.y,point.z))
  }
  let curve = new THREE.CatmullRomCurve3(curvePoints,false,'catmullrom',0.000001);
  return curve;
}


export const RouteLine=(curve,option)=>{
  let points = curve.getPoints(100);
  let geometry = new THREE.Geometry();
  geometry.vertices=points;
  let material = new THREE.LineBasicMaterial({color:0x4488ff});
  let line = new THREE.Line(geometry,material);
  line.name=option.objName;
  line.type="Route";
  return line;
}
